﻿using System;
using System.Collections.Generic;
using System.Text;
using WordLib.Model;

namespace WordService.Utility
{
    public static class ViewFilter
    {
        public static IList<InputDataModel> ModelListFilter(IList<InputDataModel> dataList, Boolean isComplete, Boolean isSame)
        {
            IList<InputDataModel> resultList = new List<InputDataModel>();
            ((List<InputDataModel>)resultList).AddRange(dataList);
            if (!isComplete)
            {
                foreach (InputDataModel data in dataList)
                {
                    if (!ViewUtil.IsComplete(data))
                    {
                        resultList.Remove(data);
                    }
                }
            }
            if (!isSame)
            {
                IList<InputDataModel> indexes = new List<InputDataModel>();
                foreach (InputDataModel data in resultList)
                {
                    indexes.Add(data);
                }
                resultList.Clear();
                foreach (InputDataModel index in indexes)
                {
                    if (!ViewUtil.IsContain(resultList, index))
                    {
                        resultList.Add(index);
                    }
                }
            }
            return resultList;
        }
    }
}
